<?php
/**
 * 获取
 *
 * 
 */
 
use Workerman\Worker;
use Workerman\Mysql;

class get_validate_logon{
	
	public function entry($param){
		
		return $this->do_get_validate_logon($param);
	}

	
	/** 
	* do_get_validate_logon  
	* 
	* 
	* @access private 
	* @param $param 
	* @since 1.0 
	* @return array(errcode,errmsg,rtv) 
	*/
	private function do_get_validate_logon($param){

        $username = $param["username"];
        $password  = $param["password"];
        $sql = "select id,name,`groups` from hf_mes_user where user='".$username."' and pwd='".strtoupper(md5($password))."';";
        
        $dp=sql_query($sql);
        if(count($dp)<=0){
            return array("errcode"=>4002, "errmsg"=>"用户名或密码错误", "rtval"=>null);
        }
        return array("errcode"=>0, "errmsg"=>$dp[0]["id"], "rtval"=>$ret);
		
	}
	 
	 
	/** 
	* create  
	* 通过 call_user_func 获得本class的实例
	* 
	* @access public 
	* @since 1.0 
	* @return object 本类的实例
	*/	
    public static function create(){  
        static $instance;
        if (!$instance){  
			$instance = new get_validate_logon();  
        }
		return $instance;  
    }   
 }
 

?>